#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
	int i,j,a,b;
	int x=1;
	int y=10;
	int velocity_x = 1;
	int velocity_y = 1;
	int left = 0;
	int right = 20;
	int top = 0;
	int bottom = 10;
	
	while (1)
	{
		x=x+velocity_x;
		y=y+velocity_y;
		system("cls");
		for (i=1;i<=bottom;i++)
		{
			for (j=1;j<=right;j++)
			{
				if(i==x && j==y)			
					printf("o");
				else if (i==1||i==bottom||j==1||j==right)	
					printf("*");
				else	
					printf(" ");
			}
			printf("\n");
		}
		if(x>bottom || x<top)
			velocity_x = -velocity_x;
		if(y>right || y<left)
			velocity_y = -velocity_y;
		if(x==bottom || x==top || y==right || y==left)
			printf("\a");
		Sleep(50);
	}
	return 0;
}